home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / recent / iib122.lha / IIB / Threads / Additional / IARexx.lha / SpiralBall.irx < prev    next >
Text File  |  1997-03-19  |  3KB  |  114 lines

  1. /*
  2.              Imagine5.0 Arexx Spiral Ball Creator
  3.  
  4.              1996 Ernie - Freely distributable
  5.                   (from an original script of Rob Darke)
  6. */
  7. SYGNAL ON desist
  8. ADDRESS 'Imagine.1'
  9.  
  10. NL = '0A'x
  11.  
  12. IF ~EXISTS('LIBS:rexxreqtools.library') THEN DO
  13.    NOTIFY 'Please install the rexxreqtools.library into your LIBS: directory'
  14.    NOTIFY 'It is available from /pub/aminet/util/rexx/RexxReqTools.lha'
  15.    exit
  16. END
  17. CALL ADDLIB('rexxreqtools.library',0,-30,0)
  18.  
  19. IF ~EXISTS('LIBS:rexxmathlib.library') THEN DO
  20.   CALL rtezrequest('Please install the rexxmathlib.library into your LIBS: directory' || NL || NL ||,
  21.                    'The library is available from pub/aminet/util/rexx/RexxMathLib1.3.lha','Great, thanks!','Go get RexxMathLib.library','rt_reqpos = reqpos_centerscr')
  22.   exit
  23. END
  24. CALL ADDLIB('rexxmathlib.library',0,-30,0)
  25.  
  26. DISPLAYREXXPTR ON
  27.  
  28. radius = rtgetlong(25,'Enter spiral radius','Spiral Radius',,'rt_reqpos = reqpos_centerscr')
  29. if ~rtresult then CALL desist
  30.  
  31. distance = rtgetlong(100,'Enter spiral length','Spiral Length',,'rt_reqpos = reqpos_centerscr')
  32. if ~rtresult then CALL desist
  33.  
  34. angle = rtgetlong(720,'Enter total rotation angle','Spiral Rotation',,'rt_reqpos = reqpos_centerscr')
  35. if ~rtresult then CALL desist
  36.  
  37. balls = 0
  38. do while (balls = 0)
  39.    balls = rtgetlong(20,'Enter number of Balls','Total Balls',,'rt_reqpos = reqpos_centerscr')
  40. end
  41.  
  42. if ~rtresult then CALL desist
  43.  
  44. ra = rtgetlong(32,'Enter radius of Balls','Balls Radius',,'rt_reqpos = reqpos_centerscr')
  45. if ~rtresult then CALL desist
  46.  
  47.  
  48. axesname = rtgetstring('SPIRAL.BALLS','Enter base name for Balls objects','Object name',,'rt_reqpos = reqpos_centerscr')
  49. if ~rtresult then CALL desist
  50.  
  51. ret = rtezrequest('I am going to create a spiral set of 'balls' Balls' || NL ||,
  52.                   '           Radius = 'radius || NL ||,
  53.                   '           Length = 'distance || NL ||,
  54.                   '         Rotation = 'angle || NL ||,
  55.                   '      Ball Radius = 'ra || NL ||,
  56.                   ' Object base name = 'axesname, ' _Ok | _Abort','Notification','rt_reqpos = reqpos_centerscr')
  57. if ~ret then CALL desist
  58.  
  59. /* So now lets begin ... won't this be fun ... */
  60.  
  61. singleangle = angle / (balls)
  62. singlestep = distance / (balls-1)
  63.  
  64. pi = 3.141592654
  65. po = (pi * 2)
  66.  
  67. DETAILEDITOR
  68. ZOOM 1
  69. /*CENTERAT 0 0 0*/
  70. OBJECTMODE
  71. MULTIPICKOFF
  72.  
  73. do i = 0 to (balls-1)
  74.  
  75.    se = ((((singleangle*i) / 360)*po)-pi)
  76.    x = (radius * sin(se))
  77.    y = (radius * cos(se))
  78.    z = (i * singlestep)
  79.  
  80.    ADDCSGSPHERE
  81.    DISPLAYSTOPREDRAW /* lets speed this a little */
  82.    PICK
  83.    TRANSFORM_POSITION x y z
  84.    /*TRANSFORM_ALIGNMENT 90 0 0*/
  85.    ATTRIB.OBJECTNAME = axesname'.'i
  86.    SETATTRIBUTES OBJECTNAME
  87.    if ra ~==32 then TRANSFORM_SIZE ra ra ra
  88.  
  89. end
  90.  
  91. ADDAXIS
  92. PICK
  93. TRANSFORMA_POSITION 0 0 0
  94. TRANSFORMA_SIZE 0 (distance+100) 0
  95. ATTRIB.OBJECTNAME = 'GROUP.'axesname
  96. SETATTRIBUTES OBJECTNAME
  97. MULTIPICKON
  98. do i = 0 to (balls-1)
  99.    PICK axesname'.'i
  100. end
  101. MULTIPICKOFF
  102. GROUPCASCADE
  103. GROUPMODE
  104. DISPLAYREXXPTR OFF
  105. IMAGINETOFRONT
  106. BEEP
  107. CALL rtezrequest('Job done. Your set of 'balls' spiral Balls awaits ...','Thanks Ernie!','Spiral Ball','rt_reqpos = reqpos_centerscr')
  108. exit
  109.  
  110. desist: procedure
  111.    DISPLAYREXXPTR OFF
  112.    exit
  113. end
  114.